/**
 * 
 */
package com.java.test.audit.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author 封裝统计数据
 *
 */
public class RemitPaymentInfo implements RowMapper<RemitPaymentInfo> {

	// 账号
	private String gameAccount;

	// 提现金额
	private double remitAmount;

	// 渠道名称
	private String remitChannelName;

	// 提款时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime remitTime;

	// 提款账号
	private String remitbankAccount;

	// 审核人
	private String reviewer;

	// 审核时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime reviewTime;

	// 出款人名称
	private String userName;

	// 最新一笔出款时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime newOutTime;

	public String getGameAccount() {
		return gameAccount;
	}

	public void setGameAccount(String gameAccount) {
		this.gameAccount = gameAccount;
	}

	public double getRemitAmount() {
		return remitAmount;
	}

	public void setRemitAmount(double remitAmount) {
		this.remitAmount = remitAmount;
	}

	public String getRemitChannelName() {
		return remitChannelName;
	}

	public void setRemitChannelName(String remitChannelName) {
		this.remitChannelName = remitChannelName;
	}

	public LocalDateTime getRemitTime() {
		return remitTime;
	}

	public void setRemitTime(LocalDateTime remitTime) {
		this.remitTime = remitTime;
	}

	public String getRemitbankAccount() {
		return remitbankAccount;
	}

	public void setRemitbankAccount(String remitbankAccount) {
		this.remitbankAccount = remitbankAccount;
	}

	public String getReviewer() {
		return reviewer;
	}

	public void setReviewer(String reviewer) {
		this.reviewer = reviewer;
	}

	public LocalDateTime getReviewTime() {
		return reviewTime;
	}

	public void setReviewTime(LocalDateTime reviewTime) {
		this.reviewTime = reviewTime;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public LocalDateTime getNewOutTime() {
		return newOutTime;
	}

	public void setNewOutTime(LocalDateTime newOutTime) {
		this.newOutTime = newOutTime;
	}

	@Override
	public RemitPaymentInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
		
		RemitPaymentInfo info = new RemitPaymentInfo();
		info.setGameAccount(rs.getString("game_account"));
		info.setNewOutTime(rs.getTimestamp("new_outTime").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setRemitAmount(rs.getDouble("remit_amount"));
		info.setRemitbankAccount(rs.getString("remit_bankaccount"));
		info.setRemitChannelName(rs.getString("remit_channelname"));
		info.setRemitTime(rs.getTimestamp("remit_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setReviewer(rs.getString("reviewer"));
		info.setReviewTime(rs.getTimestamp("audit_time")==null?null:rs.getTimestamp("audit_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setUserName(rs.getString("user_name"));
		
		return info;
	}

}
